using Microsoft.Extensions.Configuration.Json;

namespace ConfigWebApi.Common;

public class AppSettingsHelper
{
    private static IConfiguration Configuration { get; set; }

    static AppSettingsHelper()
    {
        //ReloadOnChange = true 当appsettings.json被修改时重新加载
        Configuration = new ConfigurationBuilder()
            .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
            .Build();
    }
}

// string sqlString = AppSettingsHelper.Configuration.GetConnectionString("TestConnection");
// string sqlString1 = AppSettingsHelper.Configuration["Logging:LogLevel:Default"];